<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<img src="pic_bulboff.gif" id="deng"/>
<input type="button" value="开灯" id="btn" onclick="kaideng()"/>
</body>
<script>
    function kaideng() {
        if(btn.value=="开灯"){
            deng.src="pic_bulbon.gif";
            btn.value="关灯";
        }else{
            deng.src="pic_bulboff.gif";
            btn.value="开灯";
        }
    }
</script>
</html>